﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using AssessmentTool.Services.DTO;
using AssessmentTool.PresentationLogic.Controllers;

namespace AssessmentTool.Controls
{
    public partial class ProfiloButton : UserControl
    {
        
        private ProfiloButtonController controller;
        public ProfiloButton()
        {
            InitializeComponent();
            controller = new ProfiloButtonController(this);
        }

        public void initWithProfilo(ProfiliDTO profilo)
        {
            NomeProfilo.Text = profilo.NomeProfilo;
            Percentuale.Text = ((int)profilo.PercentualeProssimita) + "%";
            controller.initWithProfilo(profilo);
        }

        private void UserControl_MouseEnter(object sender, MouseEventArgs e)
        {
            
            VisualStateManager.GoToState(this, "MouseOver", true);
        }

        private void UserControl_MouseLeave(object sender, MouseEventArgs e)
        {
            VisualStateManager.GoToState(this, "Normal", true);
        }

        private void UserControl_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
        {
            VisualStateManager.GoToState(this, "Normal", true);
        }

        private void UserControl_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            VisualStateManager.GoToState(this, "Pressed", true);
            controller.onProfiloPressed();
        }
    }
}
